﻿@model FrogFoot.Areas.FFManager.Models.GriddingViewModel
@{
    ViewBag.Title = "Estates";
}

<h2>Estates</h2>

<div class="row">
    <div class="col-xs-12">
        <table id="estatesTable" class="table table-striped table-responsive">
            <thead>
            <tr>
                <td><label>Name</label></td>
                <td><label>Code</label></td>
                <td><label>Suburb</label></td>
                <td></td>
                <td></td>
            </tr>
            </thead>
            <tbody>

            @foreach (var estate in Model.Estates)
            {
                <tr data-id="@estate.EstateId">
                    <td>@Html.TextBoxFor(x => estate.Name, new {@class = "form-control name"})</td>
                    <td>@Html.TextBoxFor(x => estate.EstateCode, new {@class = "form-control code"})</td>
                    <td>
                        <input data-id="@estate.EstateId" type="hidden" value="@estate.LocationId"/>
                        @Html.DropDownListFor(x => estate.LocationId, new SelectList(Model.Locations, "LocationId", "Name", estate.LocationId), "Select Suburb", new {@class = "form-control locationId", @style = "width: 150px;", data_id = estate.EstateId})
                        @Html.ValidationMessageFor(model => model.Estate.EstateId, "", new {@class = "text-danger"})
                    </td>
                    <td>
                        <input type="button" class="btnUpdate btn btn-default" value="Update"/>
                    </td>
                    <td>
                        @Html.ActionLink("Estate Discounts", "EstateDiscount", new {estateId = @estate.EstateId}, new {@class = "btn btn-default"})
                    </td>
                </tr>
            }
            </tbody>
        </table>
    </div>
</div>